package 狂神.GUI;

import java.awt.*;

/**
 * @ClassName: Test02
 * @Auther: Drawin
 * @Date: 2021/12/22 16:04
 * @Description:
 */

public class Test02 {
    public static void main(String[] args) {
        //展示多个窗口
        MyFrame myFrame1 = new MyFrame(100, 100, 200, 200, Color.cyan);
        MyFrame myFrame2 = new MyFrame(300, 100, 200, 200, Color.yellow);
        MyFrame myFrame3 = new MyFrame(100, 300, 200, 200, Color.red);
        MyFrame myFrame4 = new MyFrame(300, 300, 200, 200, Color.magenta);

    }
}

class MyFrame extends Frame{
    static int id=0;//窗口个数计数器

    public MyFrame(int x,int y,int w,int h,Color color){
     super("MyFrame"+(++id));
     setBounds(x,y,w,h);
     setVisible(true);
     setBackground(color);
    }
}